home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / gnu / amiga / bmake15.lzh / depend.h < prev    next >
C/C++ Source or Header  |  1991-07-07  |  3KB  |  138 lines

  1. /*    depend.h
  2.  *    (c) Copyright 1991 by Ben Eng, All Rights Reserved
  3.  *
  4.  */
  5.  
  6. #include <time.h>
  7.  
  8. #ifndef MAXSUFFIX
  9. #define MAXSUFFIX 16
  10. #endif
  11.  
  12. #ifndef MAX_MACRONAME
  13. #define MAX_MACRONAME 256
  14. #endif
  15.  
  16. #ifndef FNCALLS
  17. #define FNCALLS 1
  18. #endif
  19.  
  20. #define PATMATCH_CHAR '%'
  21. #define DEFAULT_TARGET ".DEFAULT"
  22.  
  23. #define ONCE_TARGET "ONCE"
  24. #define ALWAYS_TARGET "ALWAYS"
  25. #define NEVER_TARGET "NEVER"
  26. #define INVIS_TARGET "INVISIBLE"
  27.  
  28. struct target {
  29.     struct Node node;
  30.     struct List dependlist;
  31.     struct List commandlist;
  32.     struct List *alternate; /* if not OWNER of the commandlist */
  33.     time_t mtime;
  34.     long flags;
  35.     int line_number;
  36.     char name[ 2 ];
  37. };
  38.  
  39. /* target flags */
  40. #define TF_ADDED    0x00000001
  41. #define TF_OWNER    0x00000002
  42. #define TF_PATTERN    0x00000004
  43. #define TF_DBLCOLON 0x00000008
  44. #define TF_PHONY    0x00000010
  45. #define TF_ONCE        0x00000020
  46. #define TF_ALWAYS    0x00000040
  47. #define TF_NEVER    0x00000080
  48. #define TF_INVIS    0x00000100
  49. #define TF_BUILTIN    0x40000000
  50. #define TF_MADE        0x80000000
  51.  
  52. struct depend {
  53.     struct Node node;
  54.     char name[ 2 ];
  55. };
  56.  
  57. struct command {
  58.     struct Node node;
  59.     long flags;
  60.     char cmd[ 2 ];
  61. };
  62.  
  63. #define CF_IGNORE    0x00000001
  64. #define CF_NOECHO    0x00000002
  65.  
  66. struct patternrule {
  67.     struct Node node;
  68.     char tar_pat[ MAXPATHNAME ];
  69.     char dep_pat[ MAXPATHNAME ];
  70.     struct target *targ;
  71. };
  72.  
  73. struct macro {
  74.     struct Node node;
  75.     long flags;
  76.     char *name;    /* dynamic */
  77.     char *expansion; /* dynamic */
  78. };
  79.  
  80. struct fncall {
  81.     char *name;
  82.     int (*call)(struct macro *, char *);
  83. };
  84.  
  85. /* macro flags */
  86. #define MF_EXPANDED    0x00000001
  87. #define MF_SIMPLE    0x00000002
  88. #define MF_ADDED    0x80000000
  89.  
  90. extern struct target *default_target;
  91.  
  92. int getline( char *buf, int sz, FILE *in );
  93.  
  94. struct target *find_target( char *targetname );
  95. struct target *new_target( char *targetname );
  96. int delete_target( struct target *targ );
  97. void delete_targetlist( struct List *list );
  98. void set_default_target( struct target *targ );
  99.  
  100. struct depend *new_depend( char *dependname );
  101. int delete_depend( struct depend *dep );
  102. void delete_dependlist( struct List *list );
  103.  
  104. struct command *new_command( char *cmd );
  105. int delete_command( struct command *cmd );
  106. void delete_commandlist( struct List *list );
  107.  
  108. int pattern_match( char *pattern, char *cmpstr );
  109. struct patternrule *find_patternrule( char *dep_pat, char *tar_pat );
  110. struct patternrule *new_patternrule( char *dep_pat, char *tar_pat );
  111. int delete_patternrule( struct patternrule *rule );
  112. void delete_patternlist( struct List *list );
  113. int map_to_pattern( char *name, char *from_pat, char *to_pat, char *string );
  114. struct patternrule *add_pattern_rule( struct target *tar );
  115. struct patternrule *add_suffix_targets( char *suf );
  116.  
  117. struct target *find_macro( char *macroname );
  118. struct macro *new_macro( char *name, char *expansion );
  119. struct macro *set_macro( char *name, char *expansion );
  120. struct macro *set_simplemacro( char *name, char *expansion );
  121. void set_target_macros( char *tarname, char *depname );
  122. int delete_macro( struct macro *mac );
  123. void delete_macrolist( struct List *list );
  124.  
  125. struct fncall *find_fncall( char *name );
  126. void shift_string_left( char *string, int shift );
  127. int expand_macros( char *dest, char *src, int maxlen );
  128.  
  129. void dump_all( void );
  130.  
  131. struct target *process_targetline( char *line, struct List *cmdlist );
  132. struct macro *process_macroline( char *line );
  133.  
  134. time_t nowtime( void );
  135. void touch( const char *filename );
  136.  
  137. int recipe( const char *goalname, struct List *cmdlist );
  138.